<nc-component :data="data[index]" class="top-search">

	<!-- 预览 -->
	<template slot="preview">
		<template v-if="nc.lazyLoad">
			<div class="preview-box" :style="{background: nc.componentBgColor}">
				<div class="top-search-form">
					<template v-if="nc.searchStyle == 2">
						<div v-if="nc.iconType == 'img'" class="logo" :style="{backgroundImage:'url('+changeImgUrl(nc.imageUrl)+')'}"></div>
						<div v-if="nc.iconType == 'icon'" class="icon-box">
							<iconfont :icon="nc.icon" v-if="nc.icon" :value="nc.style ? nc.style : ''"></iconfont>
						</div>
					</template>

					<div class="top-search-box" :class="{'border-circle': nc.borderType == 2}" :style="{background: nc.elementBgColor, textAlign: nc.textAlign}">
						<span class="top-search-intro" :style="{color: nc.textColor?nc.textColor:'rgba(0,0,0,0)'}">{{ nc.title }}</span>
						<span class="top-search-icon"><i class="iconfont iconsousuo" :style="{color: nc.textColor?nc.textColor:'rgba(0,0,0,0)'}"></i></span>
					</div>
				</div>
			</div>
		</template>
	</template>

	<!-- 内容编辑 -->
	<template slot="edit-content">
		<template v-if="nc.lazyLoad">

			<div class="template-edit-title">
				<h3>搜索风格</h3>
				<div class="layui-form-item icon-radio">
					<label class="layui-form-label sm">搜索风格</label>
					<div class="layui-input-block">
						<span v-for="item in nc.tempData.styleList" v-if="nc.searchStyle==item.value">{{item.label}}</span>
						<ul class="icon-wrap">
							<li v-for="(item) in nc.tempData.styleList" class="search_type_left" @click="nc.searchStyle=item.value" :class="{'text-color border-color':nc.searchStyle==item.value}">
								<i class="iconfont" :class="[{'text-color': nc.searchStyle==item.value}, item.icon_img]"></i>
							</li>
						</ul>
					</div>

					<div class="search_logo" v-show="nc.searchStyle == 2">
						<img-icon-upload :data="{data : nc}"></img-icon-upload>
						<div class="right-wrap">
							<div class="action-box" v-show="nc.iconType == 'icon'">
								<div class="action" @click="nc.tempData.methods.iconStyle($event)"><i class="iconfont iconpifu"></i></div>
								<div class="action" :id="'search-color-' + nc.index"><i class="iconfont iconyanse"></i></div>
							</div>
							<div class="desc">建议尺寸85px*30px</div>
						</div>
					</div>
				</div>

				<div class="layui-form-item icon-radio">
					<label class="layui-form-label sm">文本位置</label>
					<div class="layui-input-block">
						<span v-for="(item) in nc.tempData.textAlignList" v-if="nc.textAlign==item.value">{{item.label}}</span>
						<ul class="icon-wrap">
							<li v-for="(item) in nc.tempData.textAlignList" @click="nc.textAlign=item.value" :class="{'text-color border-color':nc.textAlign==item.value}">
								<i class="iconfont" :class="[{'text-color': nc.textAlign==item.value}, item.icon_img]"></i>
							</li>
						</ul>
					</div>
				</div>

			</div>
			<div class="template-edit-title">
				<h3>搜索内容</h3>
				<div class="layui-form-item">
					<label class="layui-form-label sm">搜索内容</label>
					<div class="layui-input-block">
						<input type="text" v-model="nc.title" :id="'title_'+index" placeholder="请输入搜索内容" class="layui-input">
					</div>
				</div>
			</div>
		</template>
	</template>

	<!-- 样式编辑 -->
	<template slot="edit-style">

		<template v-if="nc.lazyLoad">
			<search-resource></search-resource>

			<div class="template-edit-title">
				<h3>搜索样式</h3>
				<div class="layui-form-item icon-radio">
					<label class="layui-form-label sm">框体样式</label>
					<div class="layui-input-block">
						<span v-for="item in nc.tempData.borderList" v-if="nc.borderType==item.value">{{item.label}}</span>
						<ul class="icon-wrap">
							<li v-for="(item) in nc.tempData.borderList" @click="nc.borderType=item.value" :class="{'text-color border-color':nc.borderType==item.value}">
								<i class="iconfont" :class="[{'text-color': nc.borderType==item.value}, item.icon_img]"></i>
							</li>
						</ul>
					</div>
				</div>

				<color :data="{ field : 'textColor', 'label' : '文本颜色','defaultColor': '#303133' }"></color>
				<color :data="{ field : 'elementBgColor', 'label' : '背景颜色' }"></color>

			</div>

		</template>
	</template>

	<!-- 资源 -->
	<template slot="resource">
		<js>
			var searchResourcePath = "{$resource_path}";
		</js>
		<css src="{$resource_path}/css/design.css"></css>
		<js src="{$resource_path}/js/design.js"></js>
	</template>

</nc-component>